﻿using System.ComponentModel.DataAnnotations;
using System.Reflection.PortableExecutable;
using System.Xml.Linq;

namespace Game;
class 一般角色
{
    private string name;
    public string Name
    {
        get => name;
        set => name = 管理员.获取姓名(value);
    }
    private int hp;
    public int Hp
    {
        get => hp;
        set => hp=value<0?0:value;
    }
    public bool IsLive { get; set; }
    public void 回城()
    {
        Console.WriteLine($"{Name}回城啦");
    }
    public 一般角色(string name,int hp,bool isLive)
    {
        Name = name;
        Hp = hp;
        IsLive = isLive;
    }
}
class 战士 : 一般角色
{
    private int armor;
    public int Armor
    {
        get => armor;
        set => armor = value < 0 ? 0 : value;

    }
    public void 冲锋()
    {
        Console.WriteLine($"{Name}发动了冲锋");
    }
    public 战士(string name,int hp,bool isLive,int armor):base(name,hp,isLive)
    {
        this.Armor = armor;
    }
 

}
class 法师 : 一般角色
{
    private int magic;
    public int Magic
    {
        get => magic;
        set => magic = value < 0 ? 0 : value;
    }
    public void 闪电()
    {
        Console.WriteLine($"{Name}发动了闪电");
    }
    public 法师(string name, int hp, bool isLive, int armor) : base(name, hp, isLive)
    {
        this.Magic = magic;
    }   
}